home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-36.z / lispref.info-36
Encoding:
GNU Info File  |  1998-05-21  |  49.8 KB  |  1,234 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Beeping,  Prev: Display Tables,  Up: Display
  48.  
  49. Beeping
  50. =======
  51.  
  52.    You can make XEmacs ring a bell, play a sound, or blink the screen to
  53. attract the user's attention.  Be conservative about how often you do
  54. this; frequent bells can become irritating.  Also be careful not to use
  55. beeping alone when signaling an error is appropriate.  (*Note Errors::.)
  56.  
  57.  - Function: ding &optional DONT-TERMINATE SOUND DEVICE
  58.      This function beeps, or flashes the screen (see `visible-bell'
  59.      below).  It also terminates any keyboard macro currently executing
  60.      unless DONT-TERMINATE is non-`nil'.  If SOUND is specified, it
  61.      should be a symbol specifying which sound to make.  This sound
  62.      will be played if `visible-bell' is `nil'. (This only works if
  63.      sound support was compiled into the executable and you are running
  64.      on the console of a Sun SparcStation, SGI, or HP9000s700.
  65.      Otherwise you just get a beep.) The optional third argument
  66.      specifies what device to make the sound on, and defaults to the
  67.      selected device.
  68.  
  69.  - Function: beep &optional DONT-TERMINATE SOUND DEVICE
  70.      This is a synonym for `ding'.
  71.  
  72.  - User Option: visible-bell
  73.      This variable determines whether XEmacs should flash the screen to
  74.      represent a bell.  Non-`nil' means yes, `nil' means no.  On TTY
  75.      devices, this is effective only if the Termcap entry for the
  76.      terminal type has the visible bell flag (`vb') set.
  77.  
  78.  - Variable: sound-alist
  79.      This variable holds an alist associating names with sounds.  When
  80.      `beep' or `ding' is called with one of the name symbols, the
  81.      associated sound will be generated instead of the standard beep.
  82.  
  83.      Each element of `sound-alist' is a list describing a sound.  The
  84.      first element of the list is the name of the sound being defined.
  85.      Subsequent elements of the list are alternating keyword/value
  86.      pairs:
  87.  
  88.     `sound'
  89.           A string of raw sound data, or the name of another sound to
  90.           play.  The symbol `t' here means use the default X beep.
  91.  
  92.     `volume'
  93.           An integer from 0-100, defaulting to `bell-volume'.
  94.  
  95.     `pitch'
  96.           If using the default X beep, the pitch (Hz) to generate.
  97.  
  98.     `duration'
  99.           If using the default X beep, the duration (milliseconds).
  100.  
  101.      For compatibility, elements of `sound-alist' may also be:
  102.  
  103.         * `( sound-name . <sound> )'
  104.  
  105.         * `( sound-name <volume> <sound> )'
  106.  
  107.      You should probably add things to this list by calling the function
  108.      `load-sound-file'.
  109.  
  110.      Caveats:
  111.  
  112.         - You can only play audio data if running on the console screen
  113.           of a Sun SparcStation, SGI, or HP9000s700.
  114.  
  115.         - The pitch, duration, and volume options are available
  116.           everywhere, but many X servers ignore the `pitch' option.
  117.  
  118.      The following beep-types are used by XEmacs itself:
  119.  
  120.     `auto-save-error'
  121.           when an auto-save does not succeed
  122.  
  123.     `command-error'
  124.           when the XEmacs command loop catches an error
  125.  
  126.     `undefined-key'
  127.           when you type a key that is undefined
  128.  
  129.     `undefined-click'
  130.           when you use an undefined mouse-click combination
  131.  
  132.     `no-completion'
  133.           during completing-read
  134.  
  135.     `y-or-n-p'
  136.           when you type something other than 'y' or 'n'
  137.  
  138.     `yes-or-no-p'
  139.           when you type something other than 'yes' or 'no'
  140.  
  141.     `default'
  142.           used when nothing else is appropriate.
  143.  
  144.      Other lisp packages may use other beep types, but these are the
  145.      ones that the C kernel of XEmacs uses.
  146.  
  147.  - User Option: bell-volume
  148.      This variable specifies the default volume for sounds, from 0 to
  149.      100.
  150.  
  151.  - Command: load-default-sounds
  152.      This function loads and installs some sound files as beep-types.
  153.  
  154.  - Command: load-sound-file FILENAME SOUND-NAME &optional VOLUME
  155.      This function reads in an audio file and adds it to `sound-alist'.
  156.      The sound file must be in the Sun/NeXT U-LAW format.  SOUND-NAME
  157.      should be a symbol, specifying the name of the sound.  If VOLUME
  158.      is specified, the sound will be played at that volume; otherwise,
  159.      the value of BELL-VOLUME will be used.
  160.  
  161.  - Function: play-sound SOUND &optional VOLUME DEVICE
  162.      This function plays sound SOUND, which should be a symbol
  163.      mentioned in `sound-alist'.  If VOLUME is specified, it overrides
  164.      the value (if any) specified in `sound-alist'.  DEVICE specifies
  165.      the device to play the sound on, and defaults to the selected
  166.      device.
  167.  
  168.  - Command: play-sound-file FILE &optional VOLUME DEVICE
  169.      This function plays the named sound file at volume VOLUME, which
  170.      defaults to `bell-volume'.  DEVICE specifies the device to play
  171.      the sound on, and defaults to the selected device.
  172.  
  173. 
  174. File: lispref.info,  Node: Hash Tables,  Next: Range Tables,  Prev: Display,  Up: Top
  175.  
  176. Hash Tables
  177. ***********
  178.  
  179.  - Function: hashtablep OBJECT
  180.      This function returns non-`nil' if OBJECT is a hash table.
  181.  
  182. * Menu:
  183.  
  184. * Introduction to Hash Tables::    Hash tables are fast data structures for
  185.                                 implementing simple tables (i.e. finite
  186.                                 mappings from keys to values).
  187. * Working With Hash Tables::    Hash table functions.
  188. * Weak Hash Tables::            Hash tables with special garbage-collection
  189.                                 behavior.
  190.  
  191. 
  192. File: lispref.info,  Node: Introduction to Hash Tables,  Next: Working With Hash Tables,  Up: Hash Tables
  193.  
  194. Introduction to Hash Tables
  195. ===========================
  196.  
  197.    A hash table is a data structure that provides mappings from
  198. arbitrary Lisp objects (called "keys") to other arbitrary Lisp objects
  199. (called "values").  There are many ways other than hash tables of
  200. implementing the same sort of mapping, e.g.  association lists (*note
  201. Association Lists::.) and property lists (*note Property Lists::.), but
  202. hash tables provide much faster lookup.
  203.  
  204.    When you create a hash table, you specify a size, which indicates the
  205. expected number of elements that the table will hold.  You are not
  206. bound by this size, however; hash tables automatically resize themselves
  207. if the number of elements becomes too large.
  208.  
  209.    (Internally, hash tables are hashed using a modification of the
  210. "linear probing" hash table method.  This method hashes each key to a
  211. particular spot in the hash table, and then scans forward sequentially
  212. until a blank entry is found.  To look up a key, hash to the
  213. appropriate spot, then search forward for the key until either a key is
  214. found or a blank entry stops the search.  The modification actually
  215. used is called "double hashing" and involves moving forward by a fixed
  216. increment, whose value is computed from the original hash value, rather
  217. than always moving forward by one.  This eliminates problems with
  218. clustering that can arise from the simple linear probing method.  For
  219. more information, see `Algorithms' (second edition) by Robert
  220. Sedgewick, pp. 236-241.)
  221.  
  222.  - Function: make-hashtable SIZE &optional TEST-FUN
  223.      This function makes a hash table of initial size SIZE.  Comparison
  224.      between keys is normally done with `eql'; i.e. two keys must be the
  225.      same object to be considered equivalent.  However, you can
  226.      explicitly specify the comparison function using TEST-FUN, which
  227.      must be one of `eq', `eql', or `equal'.
  228.  
  229.      Note that currently, `eq' and `eql' are the same.  This will
  230.      change when bignums are implemented.
  231.  
  232.  - Function: copy-hashtable OLD-TABLE
  233.      This function makes a new hash table which contains the same keys
  234.      and values as the given table.  The keys and values will not
  235.      themselves be copied.
  236.  
  237.  - Function: hashtable-fullness TABLE
  238.      This function returns number of entries in TABLE.
  239.  
  240. 
  241. File: lispref.info,  Node: Working With Hash Tables,  Next: Weak Hash Tables,  Prev: Introduction to Hash Tables,  Up: Hash Tables
  242.  
  243. Working With Hash Tables
  244. ========================
  245.  
  246.  - Function: puthash KEY VAL TABLE
  247.      This function hashes KEY to VAL in TABLE.
  248.  
  249.  - Function: gethash KEY TABLE &optional DEFAULT
  250.      This function finds the hash value for KEY in TABLE.  If there is
  251.      no corresponding value, DEFAULT is returned (defaults to `nil').
  252.  
  253.  - Function: remhash KEY TABLE
  254.      This function removes the hash value for KEY in TABLE.
  255.  
  256.  - Function: clrhash TABLE
  257.      This function flushes TABLE.  Afterwards, the hash table will
  258.      contain no entries.
  259.  
  260.  - Function: maphash FUNCTION TABLE
  261.      This function maps FUNCTION over entries in TABLE, calling it with
  262.      two args, each key and value in the table.
  263.  
  264. 
  265. File: lispref.info,  Node: Weak Hash Tables,  Prev: Working With Hash Tables,  Up: Hash Tables
  266.  
  267. Weak Hash Tables
  268. ================
  269.  
  270.    A "weak hash table" is a special variety of hash table whose
  271. elements do not count as GC referents.  For any key-value pair in such a
  272. hash table, if either the key or value (or in some cases, if one
  273. particular one of the two) has no references to it outside of weak hash
  274. tables (and similar structures such as weak lists), the pair will be
  275. removed from the table, and the key and value collected.  A non-weak
  276. hash table (or any other pointer) would prevent the objects from being
  277. collected.
  278.  
  279.    Weak hash tables are useful for keeping track of information in a
  280. non-obtrusive way, for example to implement caching.  If the cache
  281. contains objects such as buffers, markers, image instances, etc. that
  282. will eventually disappear and get garbage-collected, using a weak hash
  283. table ensures that these objects are collected normally rather than
  284. remaining around forever, long past their actual period of use.
  285. (Otherwise, you'd have to explicitly map over the hash table every so
  286. often and remove unnecessary elements.)
  287.  
  288.    There are three types of weak hash tables:
  289.  
  290. fully weak hash tables
  291.      In these hash tables, a pair disappears if either the key or the
  292.      value is unreferenced outside of the table.
  293.  
  294. key-weak hash tables
  295.      In these hash tables, a pair disappears if the key is unreferenced
  296.      outside of the table, regardless of how the value is referenced.
  297.  
  298. value-weak hash tables
  299.      In these hash tables, a pair disappears if the value is
  300.      unreferenced outside of the table, regardless of how the key is
  301.      referenced.
  302.  
  303.    Also see *Note Weak Lists::.
  304.  
  305.  - Function: make-weak-hashtable SIZE &optional TEST-FUN
  306.      This function makes a fully weak hash table of initial size SIZE.
  307.      TEST-FUN is as in `make-hashtable'.
  308.  
  309.  - Function: make-key-weak-hashtable SIZE &optional TEST-FUN
  310.      This function makes a key-weak hash table of initial size SIZE.
  311.      TEST-FUN is as in `make-hashtable'.
  312.  
  313.  - Function: make-value-weak-hashtable SIZE &optional TEST-FUN
  314.      This function makes a value-weak hash table of initial size SIZE.
  315.      TEST-FUN is as in `make-hashtable'.
  316.  
  317. 
  318. File: lispref.info,  Node: Range Tables,  Next: Databases,  Prev: Hash Tables,  Up: Top
  319.  
  320. Range Tables
  321. ************
  322.  
  323.    A range table is a table that efficiently associated values with
  324. ranges of integers.
  325.  
  326.    Note that range tables have a read syntax, like this:
  327.  
  328.      #s(range-table data ((-3 2) foo (5 20) bar))
  329.  
  330.    This maps integers in the range (-3, 2) to `foo' and integers in the
  331. range (5, 20) to `bar'.
  332.  
  333.  - Function: range-table-p OBJECT
  334.      Return non-`nil' if OBJECT is a range table.
  335.  
  336. * Menu:
  337.  
  338. * Introduction to Range Tables:: Range tables efficiently map ranges of
  339.                                  integers to values.
  340. * Working With Range Tables::    Range table functions.
  341.  
  342. 
  343. File: lispref.info,  Node: Introduction to Range Tables,  Next: Working With Range Tables,  Up: Range Tables
  344.  
  345. Introduction to Range Tables
  346. ============================
  347.  
  348.  - Function: make-range-table
  349.      Make a new, empty range table.
  350.  
  351.  - Function: copy-range-table OLD-TABLE
  352.      Make a new range table which contains the same values for the same
  353.      ranges as the given table.  The values will not themselves be
  354.      copied.
  355.  
  356. 
  357. File: lispref.info,  Node: Working With Range Tables,  Prev: Introduction to Range Tables,  Up: Range Tables
  358.  
  359. Working With Range Tables
  360. =========================
  361.  
  362.  - Function: get-range-table POS TABLE &optional DEFAULT
  363.      This function finds value for position POS in TABLE.  If there is
  364.      no corresponding value, return DEFAULT (defaults to `nil').
  365.  
  366.  - Function: put-range-table START END VAL TABLE
  367.      This function sets the value for range (START, END) to be VAL in
  368.      TABLE.
  369.  
  370.  - Function: remove-range-table START END TABLE
  371.      This function removes the value for range (START, END) in TABLE.
  372.  
  373.  - Function: clear-range-table TABLE
  374.      This function flushes TABLE.
  375.  
  376.  - Function: map-range-table FUNCTION TABLE
  377.      This function maps FUNCTION over entries in TABLE, calling it with
  378.      three args, the beginning and end of the range and the
  379.      corresponding value.
  380.  
  381. 
  382. File: lispref.info,  Node: Databases,  Next: Processes,  Prev: Range Tables,  Up: Top
  383.  
  384. Databases
  385. *********
  386.  
  387.  - Function: databasep OBJECT
  388.      This function returns non-`nil' if OBJECT is a database.
  389.  
  390. * Menu:
  391.  
  392. * Connecting to a Database::
  393. * Working With a Database::
  394. * Other Database Functions::
  395.  
  396. 
  397. File: lispref.info,  Node: Connecting to a Database,  Next: Working With a Database,  Up: Databases
  398.  
  399. Connecting to a Database
  400. ========================
  401.  
  402.  - Function: open-database FILE &optional TYPE SUBTYPE ACCESS MODE
  403.      This function opens database FILE, using database method TYPE and
  404.      SUBTYPE, with access rights ACCESS and permissions MODE.  ACCESS
  405.      can be any combination of `r' `w' and `+', for read, write, and
  406.      creation flags.
  407.  
  408.      TYPE can have the value `'dbm' or `'berkeley_db' to select the
  409.      type of database file to use.  (Note:  XEmacs may not support both
  410.      of these types.)
  411.  
  412.      For a TYPE of `'dbm', there are no subtypes, so SUBTYPE should by
  413.      `nil'.
  414.  
  415.      For a TYPE of `'berkeley_db', the following subtypes are
  416.      available:  `'hash', `'btree', and `'recno'.  See the manpages for
  417.      the Berkeley DB functions to more information about these types.
  418.  
  419.  - Function: close-database OBJ
  420.      This function closes database OBJ.
  421.  
  422.  - Function: database-live-p OBJ
  423.      This function returns `t' iff OBJ is an active database, else
  424.      `nil'.
  425.  
  426. 
  427. File: lispref.info,  Node: Working With a Database,  Next: Other Database Functions,  Prev: Connecting to a Database,  Up: Databases
  428.  
  429. Working With a Database
  430. =======================
  431.  
  432.  - Function: get-database KEY DBASE &optional DEFAULT
  433.      This function finds the value for KEY in DATABASE.  If there is no
  434.      corresponding value, DEFAULT is returned (`nil' if DEFAULT is
  435.      omitted).
  436.  
  437.  - Function: map-database FUNCTION DBASE
  438.      This function maps FUNCTION over entries in DATABASE, calling it
  439.      with two args, each key and value in the database.
  440.  
  441.  - Function: put-database KEY VAL DBASE &optional REPLACE
  442.      This function stores KEY and VAL in DATABASE.  If optional fourth
  443.      arg REPLACE is non-`nil', replace any existing entry in the
  444.      database.
  445.  
  446.  - Function: remove-database KEY DBASE
  447.      This function removes KEY from DATABASE.
  448.  
  449. 
  450. File: lispref.info,  Node: Other Database Functions,  Prev: Working With a Database,  Up: Databases
  451.  
  452. Other Database Functions
  453. ========================
  454.  
  455.  - Function: database-file-name OBJ
  456.      This function returns the filename associated with the database
  457.      OBJ.
  458.  
  459.  - Function: database-last-error &optional OBJ
  460.      This function returns the last error associated with database OBJ.
  461.  
  462.  - Function: database-subtype OBJ
  463.      This function returns the subtype of database OBJ, if any.
  464.  
  465.  - Function: database-type OBJ
  466.      This function returns the type of database OBJ.
  467.  
  468. 
  469. File: lispref.info,  Node: Processes,  Next: System Interface,  Prev: Databases,  Up: Top
  470.  
  471. Processes
  472. *********
  473.  
  474.    In the terminology of operating systems, a "process" is a space in
  475. which a program can execute.  XEmacs runs in a process.  XEmacs Lisp
  476. programs can invoke other programs in processes of their own.  These are
  477. called "subprocesses" or "child processes" of the XEmacs process, which
  478. is their "parent process".
  479.  
  480.    A subprocess of XEmacs may be "synchronous" or "asynchronous",
  481. depending on how it is created.  When you create a synchronous
  482. subprocess, the Lisp program waits for the subprocess to terminate
  483. before continuing execution.  When you create an asynchronous
  484. subprocess, it can run in parallel with the Lisp program.  This kind of
  485. subprocess is represented within XEmacs by a Lisp object which is also
  486. called a "process".  Lisp programs can use this object to communicate
  487. with the subprocess or to control it.  For example, you can send
  488. signals, obtain status information, receive output from the process, or
  489. send input to it.
  490.  
  491.  - Function: processp OBJECT
  492.      This function returns `t' if OBJECT is a process, `nil' otherwise.
  493.  
  494. * Menu:
  495.  
  496. * Subprocess Creation::      Functions that start subprocesses.
  497. * Synchronous Processes::    Details of using synchronous subprocesses.
  498. * MS-DOS Subprocesses::      On MS-DOS, you must indicate text vs binary
  499.                                 for data sent to and from a subprocess.
  500. * Asynchronous Processes::   Starting up an asynchronous subprocess.
  501. * Deleting Processes::       Eliminating an asynchronous subprocess.
  502. * Process Information::      Accessing run-status and other attributes.
  503. * Input to Processes::       Sending input to an asynchronous subprocess.
  504. * Signals to Processes::     Stopping, continuing or interrupting
  505.                                an asynchronous subprocess.
  506. * Output from Processes::    Collecting output from an asynchronous subprocess.
  507. * Sentinels::                Sentinels run when process run-status changes.
  508. * Process Window Size::      Changing the logical window size of a process.
  509. * Transaction Queues::         Transaction-based communication with subprocesses.
  510. * Network::                  Opening network connections.
  511.  
  512. 
  513. File: lispref.info,  Node: Subprocess Creation,  Next: Synchronous Processes,  Up: Processes
  514.  
  515. Functions that Create Subprocesses
  516. ==================================
  517.  
  518.    There are three functions that create a new subprocess in which to
  519. run a program.  One of them, `start-process', creates an asynchronous
  520. process and returns a process object (*note Asynchronous Processes::.).
  521. The other two, `call-process' and `call-process-region', create a
  522. synchronous process and do not return a process object (*note
  523. Synchronous Processes::.).
  524.  
  525.    Synchronous and asynchronous processes are explained in following
  526. sections.  Since the three functions are all called in a similar
  527. fashion, their common arguments are described here.
  528.  
  529.    In all cases, the function's PROGRAM argument specifies the program
  530. to be run.  An error is signaled if the file is not found or cannot be
  531. executed.  If the file name is relative, the variable `exec-path'
  532. contains a list of directories to search.  Emacs initializes
  533. `exec-path' when it starts up, based on the value of the environment
  534. variable `PATH'.  The standard file name constructs, `~', `.', and
  535. `..', are interpreted as usual in `exec-path', but environment variable
  536. substitutions (`$HOME', etc.) are not recognized; use
  537. `substitute-in-file-name' to perform them (*note File Name
  538. Expansion::.).
  539.  
  540.    Each of the subprocess-creating functions has a BUFFER-OR-NAME
  541. argument which specifies where the standard output from the program will
  542. go.  If BUFFER-OR-NAME is `nil', that says to discard the output unless
  543. a filter function handles it.  (*Note Filter Functions::, and *Note
  544. Read and Print::.)  Normally, you should avoid having multiple
  545. processes send output to the same buffer because their output would be
  546. intermixed randomly.
  547.  
  548.    All three of the subprocess-creating functions have a `&rest'
  549. argument, ARGS.  The ARGS must all be strings, and they are supplied to
  550. PROGRAM as separate command line arguments.  Wildcard characters and
  551. other shell constructs are not allowed in these strings, since they are
  552. passed directly to the specified program.
  553.  
  554.    *Please note:* The argument PROGRAM contains only the name of the
  555. program; it may not contain any command-line arguments.  You must use
  556. ARGS to provide those.
  557.  
  558.    The subprocess gets its current directory from the value of
  559. `default-directory' (*note File Name Expansion::.).
  560.  
  561.    The subprocess inherits its environment from XEmacs; but you can
  562. specify overrides for it with `process-environment'.  *Note System
  563. Environment::.
  564.  
  565.  - Variable: exec-directory
  566.      The value of this variable is the name of a directory (a string)
  567.      that contains programs that come with XEmacs, that are intended
  568.      for XEmacs to invoke.  The program `wakeup' is an example of such
  569.      a program; the `display-time' command uses it to get a reminder
  570.      once per minute.
  571.  
  572.  - User Option: exec-path
  573.      The value of this variable is a list of directories to search for
  574.      programs to run in subprocesses.  Each element is either the name
  575.      of a directory (i.e., a string), or `nil', which stands for the
  576.      default directory (which is the value of `default-directory').
  577.  
  578.      The value of `exec-path' is used by `call-process' and
  579.      `start-process' when the PROGRAM argument is not an absolute file
  580.      name.
  581.  
  582. 
  583. File: lispref.info,  Node: Synchronous Processes,  Next: MS-DOS Subprocesses,  Prev: Subprocess Creation,  Up: Processes
  584.  
  585. Creating a Synchronous Process
  586. ==============================
  587.  
  588.    After a "synchronous process" is created, XEmacs waits for the
  589. process to terminate before continuing.  Starting Dired is an example of
  590. this: it runs `ls' in a synchronous process, then modifies the output
  591. slightly.  Because the process is synchronous, the entire directory
  592. listing arrives in the buffer before XEmacs tries to do anything with
  593. it.
  594.  
  595.    While Emacs waits for the synchronous subprocess to terminate, the
  596. user can quit by typing `C-g'.  The first `C-g' tries to kill the
  597. subprocess with a `SIGINT' signal; but it waits until the subprocess
  598. actually terminates before quitting.  If during that time the user
  599. types another `C-g', that kills the subprocess instantly with `SIGKILL'
  600. and quits immediately.  *Note Quitting::.
  601.  
  602.    The synchronous subprocess functions returned `nil' in version 18.
  603. In version 19, they return an indication of how the process terminated.
  604.  
  605.  - Function: call-process PROGRAM &optional INFILE DESTINATION DISPLAY
  606.           &rest ARGS
  607.      This function calls PROGRAM in a separate process and waits for it
  608.      to finish.
  609.  
  610.      The standard input for the process comes from file INFILE if
  611.      INFILE is not `nil' and from `/dev/null' otherwise.  The argument
  612.      DESTINATION says where to put the process output.  Here are the
  613.      possibilities:
  614.  
  615.     a buffer
  616.           Insert the output in that buffer, before point.  This
  617.           includes both the standard output stream and the standard
  618.           error stream of the process.
  619.  
  620.     a string
  621.           Find or create a buffer with that name, then insert the
  622.           output in that buffer, before point.
  623.  
  624.     `t'
  625.           Insert the output in the current buffer, before point.
  626.  
  627.     `nil'
  628.           Discard the output.
  629.  
  630.     0
  631.           Discard the output, and return immediately without waiting
  632.           for the subprocess to finish.
  633.  
  634.           In this case, the process is not truly synchronous, since it
  635.           can run in parallel with Emacs; but you can think of it as
  636.           synchronous in that Emacs is essentially finished with the
  637.           subprocess as soon as this function returns.
  638.  
  639.     (REAL-DESTINATION ERROR-DESTINATION)
  640.           Keep the standard output stream separate from the standard
  641.           error stream; deal with the ordinary output as specified by
  642.           REAL-DESTINATION, and dispose of the error output according
  643.           to ERROR-DESTINATION.  The value `nil' means discard it, `t'
  644.           means mix it with the ordinary output, and a string specifies
  645.           a file name to redirect error output into.
  646.  
  647.           You can't directly specify a buffer to put the error output
  648.           in; that is too difficult to implement.  But you can achieve
  649.           this result by sending the error output to a temporary file
  650.           and then inserting the file into a buffer.
  651.  
  652.      If DISPLAY is non-`nil', then `call-process' redisplays the buffer
  653.      as output is inserted.  Otherwise the function does no redisplay,
  654.      and the results become visible on the screen only when XEmacs
  655.      redisplays that buffer in the normal course of events.
  656.  
  657.      The remaining arguments, ARGS, are strings that specify command
  658.      line arguments for the program.
  659.  
  660.      The value returned by `call-process' (unless you told it not to
  661.      wait) indicates the reason for process termination.  A number
  662.      gives the exit status of the subprocess; 0 means success, and any
  663.      other value means failure.  If the process terminated with a
  664.      signal, `call-process' returns a string describing the signal.
  665.  
  666.      In the examples below, the buffer `foo' is current.
  667.  
  668.           (call-process "pwd" nil t)
  669.                => nil
  670.           
  671.           ---------- Buffer: foo ----------
  672.           /usr/user/lewis/manual
  673.           ---------- Buffer: foo ----------
  674.  
  675.           (call-process "grep" nil "bar" nil "lewis" "/etc/passwd")
  676.                => nil
  677.           
  678.           ---------- Buffer: bar ----------
  679.           lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh
  680.           
  681.           ---------- Buffer: bar ----------
  682.  
  683.      The `insert-directory' function contains a good example of the use
  684.      of `call-process':
  685.  
  686.           (call-process insert-directory-program nil t nil switches
  687.                         (if full-directory-p
  688.                             (concat (file-name-as-directory file) ".")
  689.                           file))
  690.  
  691.  - Function: call-process-region START END PROGRAM &optional DELETE
  692.           DESTINATION DISPLAY &rest ARGS
  693.      This function sends the text between START to END as standard
  694.      input to a process running PROGRAM.  It deletes the text sent if
  695.      DELETE is non-`nil'; this is useful when BUFFER is `t', to insert
  696.      the output in the current buffer.
  697.  
  698.      The arguments DESTINATION and DISPLAY control what to do with the
  699.      output from the subprocess, and whether to update the display as
  700.      it comes in.  For details, see the description of `call-process',
  701.      above.  If DESTINATION is the integer 0, `call-process-region'
  702.      discards the output and returns `nil' immediately, without waiting
  703.      for the subprocess to finish.
  704.  
  705.      The remaining arguments, ARGS, are strings that specify command
  706.      line arguments for the program.
  707.  
  708.      The return value of `call-process-region' is just like that of
  709.      `call-process': `nil' if you told it to return without waiting;
  710.      otherwise, a number or string which indicates how the subprocess
  711.      terminated.
  712.  
  713.      In the following example, we use `call-process-region' to run the
  714.      `cat' utility, with standard input being the first five characters
  715.      in buffer `foo' (the word `input').  `cat' copies its standard
  716.      input into its standard output.  Since the argument DESTINATION is
  717.      `t', this output is inserted in the current buffer.
  718.  
  719.           ---------- Buffer: foo ----------
  720.           input-!-
  721.           ---------- Buffer: foo ----------
  722.  
  723.           (call-process-region 1 6 "cat" nil t)
  724.                => nil
  725.           
  726.           ---------- Buffer: foo ----------
  727.           inputinput-!-
  728.           ---------- Buffer: foo ----------
  729.  
  730.      The `shell-command-on-region' command uses `call-process-region'
  731.      like this:
  732.  
  733.           (call-process-region
  734.            start end
  735.            shell-file-name      ; Name of program.
  736.            nil                  ; Do not delete region.
  737.            buffer               ; Send output to `buffer'.
  738.            nil                  ; No redisplay during output.
  739.            "-c" command)        ; Arguments for the shell.
  740.  
  741. 
  742. File: lispref.info,  Node: MS-DOS Subprocesses,  Next: Asynchronous Processes,  Prev: Synchronous Processes,  Up: Processes
  743.  
  744. MS-DOS Subprocesses
  745. ===================
  746.  
  747.    On MS-DOS, you must indicate whether the data going to and from a
  748. synchronous subprocess are text or binary.  Text data requires
  749. translation between the end-of-line convention used within Emacs (a
  750. single newline character) and the convention used outside Emacs (the
  751. two-character sequence, CRLF).
  752.  
  753.    The variable `binary-process-input' applies to input sent to the
  754. subprocess, and `binary-process-output' applies to output received from
  755. it.  A non-`nil' value means the data is non-text; `nil' means the data
  756. is text, and calls for conversion.
  757.  
  758.  - Variable: binary-process-input
  759.      If this variable is `nil', convert newlines to CRLF sequences in
  760.      the input to a synchronous subprocess.
  761.  
  762.  - Variable: binary-process-output
  763.      If this variable is `nil', convert CRLF sequences to newlines in
  764.      the output from a synchronous subprocess.
  765.  
  766.    *Note Files and MS-DOS::, for related information.
  767.  
  768. 
  769. File: lispref.info,  Node: Asynchronous Processes,  Next: Deleting Processes,  Prev: MS-DOS Subprocesses,  Up: Processes
  770.  
  771. Creating an Asynchronous Process
  772. ================================
  773.  
  774.    After an "asynchronous process" is created, Emacs and the Lisp
  775. program both continue running immediately.  The process may thereafter
  776. run in parallel with Emacs, and the two may communicate with each other
  777. using the functions described in following sections.  Here we describe
  778. how to create an asynchronous process with `start-process'.
  779.  
  780.  - Function: start-process NAME BUFFER-OR-NAME PROGRAM &rest ARGS
  781.      This function creates a new asynchronous subprocess and starts the
  782.      program PROGRAM running in it.  It returns a process object that
  783.      stands for the new subprocess in Lisp.  The argument NAME
  784.      specifies the name for the process object; if a process with this
  785.      name already exists, then NAME is modified (by adding `<1>', etc.)
  786.      to be unique.  The buffer BUFFER-OR-NAME is the buffer to
  787.      associate with the process.
  788.  
  789.      The remaining arguments, ARGS, are strings that specify command
  790.      line arguments for the program.
  791.  
  792.      In the example below, the first process is started and runs
  793.      (rather, sleeps) for 100 seconds.  Meanwhile, the second process
  794.      is started, and given the name `my-process<1>' for the sake of
  795.      uniqueness.  It inserts the directory listing at the end of the
  796.      buffer `foo', before the first process finishes.  Then it
  797.      finishes, and a message to that effect is inserted in the buffer.
  798.      Much later, the first process finishes, and another message is
  799.      inserted in the buffer for it.
  800.  
  801.           (start-process "my-process" "foo" "sleep" "100")
  802.                => #<process my-process>
  803.  
  804.           (start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin")
  805.                => #<process my-process<1>>
  806.           
  807.           ---------- Buffer: foo ----------
  808.           total 2
  809.           lrwxrwxrwx  1 lewis     14 Jul 22 10:12 gnuemacs --> /emacs
  810.           -rwxrwxrwx  1 lewis     19 Jul 30 21:02 lemon
  811.           
  812.           Process my-process<1> finished
  813.           
  814.           Process my-process finished
  815.           ---------- Buffer: foo ----------
  816.  
  817.  - Function: start-process-shell-command NAME BUFFER-OR-NAME COMMAND
  818.           &rest COMMAND-ARGS
  819.      This function is like `start-process' except that it uses a shell
  820.      to execute the specified command.  The argument COMMAND is a shell
  821.      command name, and COMMAND-ARGS are the arguments for the shell
  822.      command.
  823.  
  824.  - Variable: process-connection-type
  825.      This variable controls the type of device used to communicate with
  826.      asynchronous subprocesses.  If it is non-`nil', then PTYs are
  827.      used, when available.  Otherwise, pipes are used.
  828.  
  829.      PTYs are usually preferable for processes visible to the user, as
  830.      in Shell mode, because they allow job control (`C-c', `C-z', etc.)
  831.      to work between the process and its children whereas pipes do not.
  832.      For subprocesses used for internal purposes by programs, it is
  833.      often better to use a pipe, because they are more efficient.  In
  834.      addition, the total number of PTYs is limited on many systems and
  835.      it is good not to waste them.
  836.  
  837.      The value `process-connection-type' is used when `start-process'
  838.      is called.  So you can specify how to communicate with one
  839.      subprocess by binding the variable around the call to
  840.      `start-process'.
  841.  
  842.           (let ((process-connection-type nil))  ; Use a pipe.
  843.             (start-process ...))
  844.  
  845.      To determine whether a given subprocess actually got a pipe or a
  846.      PTY, use the function `process-tty-name' (*note Process
  847.      Information::.).
  848.  
  849. 
  850. File: lispref.info,  Node: Deleting Processes,  Next: Process Information,  Prev: Asynchronous Processes,  Up: Processes
  851.  
  852. Deleting Processes
  853. ==================
  854.  
  855.    "Deleting a process" disconnects XEmacs immediately from the
  856. subprocess, and removes it from the list of active processes.  It sends
  857. a signal to the subprocess to make the subprocess terminate, but this is
  858. not guaranteed to happen immediately.  The process object itself
  859. continues to exist as long as other Lisp objects point to it.
  860.  
  861.    You can delete a process explicitly at any time.  Processes are
  862. deleted automatically after they terminate, but not necessarily right
  863. away.  If you delete a terminated process explicitly before it is
  864. deleted automatically, no harm results.
  865.  
  866.  - Variable: delete-exited-processes
  867.      This variable controls automatic deletion of processes that have
  868.      terminated (due to calling `exit' or to a signal).  If it is
  869.      `nil', then they continue to exist until the user runs
  870.      `list-processes'.  Otherwise, they are deleted immediately after
  871.      they exit.
  872.  
  873.  - Function: delete-process NAME
  874.      This function deletes the process associated with NAME, killing it
  875.      with a `SIGHUP' signal.  The argument NAME may be a process, the
  876.      name of a process, a buffer, or the name of a buffer.
  877.  
  878.           (delete-process "*shell*")
  879.                => nil
  880.  
  881.  - Function: process-kill-without-query PROCESS &optional
  882.           REQUIRE-QUERY-P
  883.      This function declares that XEmacs need not query the user if
  884.      PROCESS is still running when XEmacs is exited.  The process will
  885.      be deleted silently.  If REQUIRE-QUERY-P is non-`nil', then XEmacs
  886.      *will* query the user (this is the default).  The return value is
  887.      `t' if a query was formerly required, and `nil' otherwise.
  888.  
  889.           (process-kill-without-query (get-process "shell"))
  890.                => t
  891.  
  892. 
  893. File: lispref.info,  Node: Process Information,  Next: Input to Processes,  Prev: Deleting Processes,  Up: Processes
  894.  
  895. Process Information
  896. ===================
  897.  
  898.    Several functions return information about processes.
  899. `list-processes' is provided for interactive use.
  900.  
  901.  - Command: list-processes
  902.      This command displays a listing of all living processes.  In
  903.      addition, it finally deletes any process whose status was `Exited'
  904.      or `Signaled'.  It returns `nil'.
  905.  
  906.  - Function: process-list
  907.      This function returns a list of all processes that have not been
  908.      deleted.
  909.  
  910.           (process-list)
  911.                => (#<process display-time> #<process shell>)
  912.  
  913.  - Function: get-process NAME
  914.      This function returns the process named NAME, or `nil' if there is
  915.      none.  An error is signaled if NAME is not a string.
  916.  
  917.           (get-process "shell")
  918.                => #<process shell>
  919.  
  920.  - Function: process-command PROCESS
  921.      This function returns the command that was executed to start
  922.      PROCESS.  This is a list of strings, the first string being the
  923.      program executed and the rest of the strings being the arguments
  924.      that were given to the program.
  925.  
  926.           (process-command (get-process "shell"))
  927.                => ("/bin/csh" "-i")
  928.  
  929.  - Function: process-id PROCESS
  930.      This function returns the PID of PROCESS.  This is an integer that
  931.      distinguishes the process PROCESS from all other processes running
  932.      on the same computer at the current time.  The PID of a process is
  933.      chosen by the operating system kernel when the process is started
  934.      and remains constant as long as the process exists.
  935.  
  936.  - Function: process-name PROCESS
  937.      This function returns the name of PROCESS.
  938.  
  939.  - Function: process-status PROCESS-NAME
  940.      This function returns the status of PROCESS-NAME as a symbol.  The
  941.      argument PROCESS-NAME must be a process, a buffer, a process name
  942.      (string) or a buffer name (string).
  943.  
  944.      The possible values for an actual subprocess are:
  945.  
  946.     `run'
  947.           for a process that is running.
  948.  
  949.     `stop'
  950.           for a process that is stopped but continuable.
  951.  
  952.     `exit'
  953.           for a process that has exited.
  954.  
  955.     `signal'
  956.           for a process that has received a fatal signal.
  957.  
  958.     `open'
  959.           for a network connection that is open.
  960.  
  961.     `closed'
  962.           for a network connection that is closed.  Once a connection
  963.           is closed, you cannot reopen it, though you might be able to
  964.           open a new connection to the same place.
  965.  
  966.     `nil'
  967.           if PROCESS-NAME is not the name of an existing process.
  968.  
  969.           (process-status "shell")
  970.                => run
  971.  
  972.           (process-status (get-buffer "*shell*"))
  973.                => run
  974.  
  975.           x
  976.                => #<process xx<1>>
  977.           (process-status x)
  978.                => exit
  979.  
  980.      For a network connection, `process-status' returns one of the
  981.      symbols `open' or `closed'.  The latter means that the other side
  982.      closed the connection, or XEmacs did `delete-process'.
  983.  
  984.      In earlier Emacs versions (prior to version 19), the status of a
  985.      network connection was `run' if open, and `exit' if closed.
  986.  
  987.  - Function: process-kill-without-query-p PROCESS
  988.      This function returns whether PROCESS will be killed without
  989.      querying the user, if it is running when XEmacs is exited.  The
  990.      default value is `nil'.
  991.  
  992.  - Function: process-exit-status PROCESS
  993.      This function returns the exit status of PROCESS or the signal
  994.      number that killed it.  (Use the result of `process-status' to
  995.      determine which of those it is.)  If PROCESS has not yet
  996.      terminated, the value is 0.
  997.  
  998.  - Function: process-tty-name PROCESS
  999.      This function returns the terminal name that PROCESS is using for
  1000.      its communication with Emacs--or `nil' if it is using pipes
  1001.      instead of a terminal (see `process-connection-type' in *Note
  1002.      Asynchronous Processes::).
  1003.  
  1004. 
  1005. File: lispref.info,  Node: Input to Processes,  Next: Signals to Processes,  Prev: Process Information,  Up: Processes
  1006.  
  1007. Sending Input to Processes
  1008. ==========================
  1009.  
  1010.    Asynchronous subprocesses receive input when it is sent to them by
  1011. XEmacs, which is done with the functions in this section.  You must
  1012. specify the process to send input to, and the input data to send.  The
  1013. data appears on the "standard input" of the subprocess.
  1014.  
  1015.    Some operating systems have limited space for buffered input in a
  1016. PTY.  On these systems, Emacs sends an EOF periodically amidst the
  1017. other characters, to force them through.  For most programs, these EOFs
  1018. do no harm.
  1019.  
  1020.  - Function: process-send-string PROCESS-NAME STRING
  1021.      This function sends PROCESS-NAME the contents of STRING as
  1022.      standard input.  The argument PROCESS-NAME must be a process or
  1023.      the name of a process.  If it is `nil', the current buffer's
  1024.      process is used.
  1025.  
  1026.      The function returns `nil'.
  1027.  
  1028.           (process-send-string "shell<1>" "ls\n")
  1029.                => nil
  1030.  
  1031.           ---------- Buffer: *shell* ----------
  1032.           ...
  1033.           introduction.texi               syntax-tables.texi~
  1034.           introduction.texi~              text.texi
  1035.           introduction.txt                text.texi~
  1036.           ...
  1037.           ---------- Buffer: *shell* ----------
  1038.  
  1039.  - Command: process-send-region PROCESS-NAME START END
  1040.      This function sends the text in the region defined by START and
  1041.      END as standard input to PROCESS-NAME, which is a process or a
  1042.      process name.  (If it is `nil', the current buffer's process is
  1043.      used.)
  1044.  
  1045.      An error is signaled unless both START and END are integers or
  1046.      markers that indicate positions in the current buffer.  (It is
  1047.      unimportant which number is larger.)
  1048.  
  1049.  - Function: process-send-eof &optional PROCESS-NAME
  1050.      This function makes PROCESS-NAME see an end-of-file in its input.
  1051.      The EOF comes after any text already sent to it.
  1052.  
  1053.      If PROCESS-NAME is not supplied, or if it is `nil', then this
  1054.      function sends the EOF to the current buffer's process.  An error
  1055.      is signaled if the current buffer has no process.
  1056.  
  1057.      The function returns PROCESS-NAME.
  1058.  
  1059.           (process-send-eof "shell")
  1060.                => "shell"
  1061.  
  1062. 
  1063. File: lispref.info,  Node: Signals to Processes,  Next: Output from Processes,  Prev: Input to Processes,  Up: Processes
  1064.  
  1065. Sending Signals to Processes
  1066. ============================
  1067.  
  1068.    "Sending a signal" to a subprocess is a way of interrupting its
  1069. activities.  There are several different signals, each with its own
  1070. meaning.  The set of signals and their names is defined by the operating
  1071. system.  For example, the signal `SIGINT' means that the user has typed
  1072. `C-c', or that some analogous thing has happened.
  1073.  
  1074.    Each signal has a standard effect on the subprocess.  Most signals
  1075. kill the subprocess, but some stop or resume execution instead.  Most
  1076. signals can optionally be handled by programs; if the program handles
  1077. the signal, then we can say nothing in general about its effects.
  1078.  
  1079.    The set of signals and their names is defined by the operating
  1080. system; XEmacs has facilities for sending only a few of the signals
  1081. that are defined.  XEmacs can send signals only to its own subprocesses.
  1082.  
  1083.    You can send signals explicitly by calling the functions in this
  1084. section.  XEmacs also sends signals automatically at certain times:
  1085. killing a buffer sends a `SIGHUP' signal to all its associated
  1086. processes; killing XEmacs sends a `SIGHUP' signal to all remaining
  1087. processes.  (`SIGHUP' is a signal that usually indicates that the user
  1088. hung up the phone.)
  1089.  
  1090.    Each of the signal-sending functions takes two optional arguments:
  1091. PROCESS-NAME and CURRENT-GROUP.
  1092.  
  1093.    The argument PROCESS-NAME must be either a process, the name of one,
  1094. or `nil'.  If it is `nil', the process defaults to the process
  1095. associated with the current buffer.  An error is signaled if
  1096. PROCESS-NAME does not identify a process.
  1097.  
  1098.    The argument CURRENT-GROUP is a flag that makes a difference when
  1099. you are running a job-control shell as an XEmacs subprocess.  If it is
  1100. non-`nil', then the signal is sent to the current process-group of the
  1101. terminal that XEmacs uses to communicate with the subprocess.  If the
  1102. process is a job-control shell, this means the shell's current subjob.
  1103. If it is `nil', the signal is sent to the process group of the
  1104. immediate subprocess of XEmacs.  If the subprocess is a job-control
  1105. shell, this is the shell itself.
  1106.  
  1107.    The flag CURRENT-GROUP has no effect when a pipe is used to
  1108. communicate with the subprocess, because the operating system does not
  1109. support the distinction in the case of pipes.  For the same reason,
  1110. job-control shells won't work when a pipe is used.  See
  1111. `process-connection-type' in *Note Asynchronous Processes::.
  1112.  
  1113.  - Function: interrupt-process &optional PROCESS-NAME CURRENT-GROUP
  1114.      This function interrupts the process PROCESS-NAME by sending the
  1115.      signal `SIGINT'.  Outside of XEmacs, typing the "interrupt
  1116.      character" (normally `C-c' on some systems, and `DEL' on others)
  1117.      sends this signal.  When the argument CURRENT-GROUP is non-`nil',
  1118.      you can think of this function as "typing `C-c'" on the terminal
  1119.      by which XEmacs talks to the subprocess.
  1120.  
  1121.  - Function: kill-process &optional PROCESS-NAME CURRENT-GROUP
  1122.      This function kills the process PROCESS-NAME by sending the signal
  1123.      `SIGKILL'.  This signal kills the subprocess immediately, and
  1124.      cannot be handled by the subprocess.
  1125.  
  1126.  - Function: quit-process &optional PROCESS-NAME CURRENT-GROUP
  1127.      This function sends the signal `SIGQUIT' to the process
  1128.      PROCESS-NAME.  This signal is the one sent by the "quit character"
  1129.      (usually `C-b' or `C-\') when you are not inside XEmacs.
  1130.  
  1131.  - Function: stop-process &optional PROCESS-NAME CURRENT-GROUP
  1132.      This function stops the process PROCESS-NAME by sending the signal
  1133.      `SIGTSTP'.  Use `continue-process' to resume its execution.
  1134.  
  1135.      On systems with job control, the "stop character" (usually `C-z')
  1136.      sends this signal (outside of XEmacs).  When CURRENT-GROUP is
  1137.      non-`nil', you can think of this function as "typing `C-z'" on the
  1138.      terminal XEmacs uses to communicate with the subprocess.
  1139.  
  1140.  - Function: continue-process &optional PROCESS-NAME CURRENT-GROUP
  1141.      This function resumes execution of the process PROCESS by sending
  1142.      it the signal `SIGCONT'.  This presumes that PROCESS-NAME was
  1143.      stopped previously.
  1144.  
  1145.  - Function: signal-process PID SIGNAL
  1146.      This function sends a signal to process PID, which need not be a
  1147.      child of XEmacs.  The argument SIGNAL specifies which signal to
  1148.      send; it should be an integer.
  1149.  
  1150. 
  1151. File: lispref.info,  Node: Output from Processes,  Next: Sentinels,  Prev: Signals to Processes,  Up: Processes
  1152.  
  1153. Receiving Output from Processes
  1154. ===============================
  1155.  
  1156.    There are two ways to receive the output that a subprocess writes to
  1157. its standard output stream.  The output can be inserted in a buffer,
  1158. which is called the associated buffer of the process, or a function
  1159. called the "filter function" can be called to act on the output.  If
  1160. the process has no buffer and no filter function, its output is
  1161. discarded.
  1162.  
  1163. * Menu:
  1164.  
  1165. * Process Buffers::       If no filter, output is put in a buffer.
  1166. * Filter Functions::      Filter functions accept output from the process.
  1167. * Accepting Output::      Explicitly permitting subprocess output.
  1168.                             Waiting for subprocess output.
  1169.  
  1170. 
  1171. File: lispref.info,  Node: Process Buffers,  Next: Filter Functions,  Up: Output from Processes
  1172.  
  1173. Process Buffers
  1174. ---------------
  1175.  
  1176.    A process can (and usually does) have an "associated buffer", which
  1177. is an ordinary Emacs buffer that is used for two purposes: storing the
  1178. output from the process, and deciding when to kill the process.  You
  1179. can also use the buffer to identify a process to operate on, since in
  1180. normal practice only one process is associated with any given buffer.
  1181. Many applications of processes also use the buffer for editing input to
  1182. be sent to the process, but this is not built into XEmacs Lisp.
  1183.  
  1184.    Unless the process has a filter function (*note Filter Functions::.),
  1185. its output is inserted in the associated buffer.  The position to insert
  1186. the output is determined by the `process-mark', which is then updated
  1187. to point to the end of the text just inserted.  Usually, but not
  1188. always, the `process-mark' is at the end of the buffer.
  1189.  
  1190.  - Function: process-buffer PROCESS
  1191.      This function returns the associated buffer of the process PROCESS.
  1192.  
  1193.           (process-buffer (get-process "shell"))
  1194.                => #<buffer *shell*>
  1195.  
  1196.  - Function: process-mark PROCESS
  1197.      This function returns the process marker for PROCESS, which is the
  1198.      marker that says where to insert output from the process.
  1199.  
  1200.      If PROCESS does not have a buffer, `process-mark' returns a marker
  1201.      that points nowhere.
  1202.  
  1203.      Insertion of process output in a buffer uses this marker to decide
  1204.      where to insert, and updates it to point after the inserted text.
  1205.      That is why successive batches of output are inserted
  1206.      consecutively.
  1207.  
  1208.      Filter functions normally should use this marker in the same
  1209.      fashion as is done by direct insertion of output in the buffer.  A
  1210.      good example of a filter function that uses `process-mark' is
  1211.      found at the end of the following section.
  1212.  
  1213.      When the user is expected to enter input in the process buffer for
  1214.      transmission to the process, the process marker is useful for
  1215.      distinguishing the new input from previous output.
  1216.  
  1217.  - Function: set-process-buffer PROCESS BUFFER
  1218.      This function sets the buffer associated with PROCESS to BUFFER.
  1219.      If BUFFER is `nil', the process becomes associated with no buffer.
  1220.  
  1221.  - Function: get-buffer-process BUFFER-OR-NAME
  1222.      This function returns the process associated with BUFFER-OR-NAME.
  1223.      If there are several processes associated with it, then one is
  1224.      chosen.  (Presently, the one chosen is the one most recently
  1225.      created.)  It is usually a bad idea to have more than one process
  1226.      associated with the same buffer.
  1227.  
  1228.           (get-buffer-process "*shell*")
  1229.                => #<process shell>
  1230.  
  1231.      Killing the process's buffer deletes the process, which kills the
  1232.      subprocess with a `SIGHUP' signal (*note Signals to Processes::.).
  1233.  
  1234.